<?php
class Base {
    protected $attributes;
    //protected $temp_metadata;

    public function __construct() {}

    protected function init() {
        if (!$this->attributes || !is_array($this->attributes)) $this->attributes = array();
        //if (!is_array($this->temp_metadata)) $this->temp_metadata = array();

        $this->attributes['id'] = 0;
        $this->attributes['created'] = 0;
        $this->attributes['updated'] = 0;
    }
    /**
     * Return the value of a given key.
     * @param $name
     * @return mixed Returns the value of a given value, or null.
     */
    public function get($name) {
        // Check base attributes
        if (isset($this->attributes[$name])) {
            return $this->attributes[$name];
        }

        // Can't find it, so return null.
        return null;
    }

    public function set($name, $value) {
        //if (array_key_exists($name, $this->attributes)) {
            $this->attributes[$name] = $value;
       // }
    }

    function __get($name) {
        return $this->get($name);
    }

    function __set($name, $value) {
        return $this->set($name, $value);
    }
}